package com.mall.sun.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.sun.model.dto.OrderDTO;
import com.mall.sun.model.dto.PageHelper;
import com.mall.sun.model.po.Orders;
import com.mall.sun.repository.mapper.OrdersMapper;
import com.mall.sun.service.OrdersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Tansty
 * @since 2021-11-30
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public OrderDTO[] getAllOrders(PageHelper pageHelper) {
        Page<OrderDTO> orderDTOPage = new Page<>(pageHelper.getCurrentPage(), pageHelper.getPageSize());
        return ordersMapper.getAllOrders(orderDTOPage);
    }

    @Override
    public int updateOrder(OrderDTO orderDTO) {
        return ordersMapper.updateOrder(orderDTO);
    }
}
